package com.atguigu.gmall.product.rpc;

import com.atguigu.gmall.common.result.Result;
import com.atguigu.gmall.product.service.BaseCategory1Service;
import com.atguigu.gmall.product.vo.CategoryTreeVo;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author lhh
 * @ClassName RpcCategoryTreeController
 * @date 2022 2022/12/3
 * 用于远程服务调用的接口
 */

@RestController
@RequestMapping("api/inner/rpc/product")
public class CategoryRpcController {

    @Resource
    BaseCategory1Service baseCategory1Service;

    /**
     * 获取三级属性
     * @return
     */
    @GetMapping("getCategoryTree")
    public Result<List<CategoryTreeVo>> getCategoryTree(){
        List<CategoryTreeVo> categoryTreeVos = baseCategory1Service.getCategoryTree();
        return Result.ok(categoryTreeVos);
    }
}
